﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using CarsClassLibrary;

namespace Logic
{
    public abstract class Creator
    {
        public abstract AbstractCar FactoryMethod();
    }

    public class ChryslerPacificaTouringCreator : Creator
    {
        public override AbstractCar FactoryMethod()
        {
            ChryslerPacificaTouring A = new ChryslerPacificaTouring();
            A.price = 1000;
            A.brand = "Автомобиль Chrysler Pacifica Touring стоимостью " + A.price + " тысяч рублей";
            return A;
        }
    }
    public class JeepCommanderCreator : Creator
    {
        public override AbstractCar FactoryMethod()
        {
            JeepCommander A = new JeepCommander();
            A.price = 1200;
            A.brand = "Автомобиль Jeep Commander стоимостью " + A.price + " тысяч рублей";
            return A;
        }
    }

    public class LamborghiniGallardoCreator : Creator
    {
        public override AbstractCar FactoryMethod()
        {
            LamborghiniGallardo A = new LamborghiniGallardo();
            A.price = 11500;
            A.brand = "Автомобиль Lamborghini Gallardo стоимостью " + A.price + " тысяч рублей";
            return A;
        }
    }
    public class MaseratiGranTurismoCreator : Creator
    {
        public override AbstractCar FactoryMethod()
        {
            MaseratiGranTurismo A = new MaseratiGranTurismo();
            A.price = 3500;
            A.brand = "Автомобиль Maserati Gran Turismo стоимостью " + A.price + " тысяч рублей";
            return A;
        }
    }
    public class OpelMerivaCreator : Creator
    {
        public override AbstractCar FactoryMethod()
        {
            OpelMeriva A = new OpelMeriva();
            A.price = 400;
            A.brand = "Автомобиль Opel Meriva стоимостью " + A.price + " тысяч рублей";
            return A;
        }
    }

    public class ProgramLogic
    {
        public List<AbstractCar> CreatePark()
        {
            List<AbstractCar> Park = new List<AbstractCar>();
            //создатели автомобилей в парке
            Creator[] Creators = new Creator[5];
            Creators[0] = new ChryslerPacificaTouringCreator();
            Creators[1] = new OpelMerivaCreator();
            Creators[2] = new MaseratiGranTurismoCreator();
            Creators[3] = new JeepCommanderCreator();
            Creators[4] = new LamborghiniGallardoCreator();
            //добаляем автомобили в парк
            foreach (Creator A in Creators)
            {
                Park.Add(A.FactoryMethod());
            }
            return Park;
        }
    }
}
